package com.health.tablebean.webservice;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import com.health.tools.ImageTools;
import com.health.viewscontrols.NovaApplication;
import com.health.db.FDbManager;
import com.health.model.PeopleType;
import com.health.tablebean.ARCHIVE_BASEINFO;
import com.health.tablebean.ARCHIVE_ENVIRONMENT;
import com.health.tablebean.ARCHIVE_FAMILYHISTORYINFO;
import com.health.tablebean.ARCHIVE_ILLNESSHISTORYINFO;
import com.health.tools.GlobalConts;
import com.novabluetooth.utils.StringUtils;

import android.content.Context;
import android.text.TextUtils;
import android.util.Log;

/**
 * @author Administrator 个人基本信息总类
 */
public class HdPersonalInfo {
	private String committee;// VARCHAR2(13) 居委会
	private String street;// VARCHAR2(10) 街道
	private String county;// VARCHAR2(7) 县
	private String city;// VARCHAR2(5) 市
	private String province;// VARCHAR2(3) 省
	private String personalid;// VARCHAR2(17) 健康档案号
	private String name;// VARCHAR2(100) 姓名
	private String sex;// VARCHAR2(10) 性别
	private String birthday;// VARCHAR2(10) 出生日期
	private String mobile;// VARCHAR2(50) 本人联系电话
	private String nation;// VARCHAR2(200) 民族
	private String householderMark;// VARCHAR2(20) 户主标志
	private String domicileType;// VARCHAR2(20) 常住地址户籍标志
	private String gbname;// VARCHAR2(500) 户籍地址
	private String gbcode;// VARCHAR2(12)
	private String zonegb;// VARCHAR2(10)
	private String address;// VARCHAR2(500) 现住址
	private String postcode;// VARCHAR2(6)
	private String phone;// VARCHAR2(20)
	private String bloodType;// VARCHAR2(20) ABO血型代码
	private String rh;// VARCHAR2(20) Rh血型标志
	private String unitName;// VARCHAR2(70) 单位名称
	private String education;// VARCHAR2(20) 学历代码
	private String occupation;// CHAR(9) 职业
	private String marriage;// VARCHAR2(20) 婚姻状况代码
	private String firstGuardian;// VARCHAR2(50)
	private String firstRelation;// VARCHAR2(20)
	private String guardianPhone1;// VARCHAR2(20)
	private String secondGuardian;// VARCHAR2(50)
	private String secondRelation;// VARCHAR2(20)
	private String guardianPhone2;// VARCHAR2(20)
	private String idtype;// VARCHAR2(10) 身份证件类别代码(证件类型)
	private String cardid;// VARCHAR2(18) 身份证（现做证件号码）
	private String educationLevel;// VARCHAR2(200)
	private String relation;// VARCHAR2(200)
	private String householderName;// VARCHAR2(50)
	private String archivesNo;// VARCHAR2(30)
	private String idcardFarm;// VARCHAR2(30)
	private String idcardHos;// VARCHAR2(30)
	private String allergy;// VARCHAR2(400)
	private String linkmanName;// VARCHAR2(50) 联系人姓名
	private String linkmanPhone;// VARCHAR2(22) 联系人电话
	private String idcardVas;// VARCHAR2(20)
	private String paymentMode;// VARCHAR2(200) 医疗费支付方式代码
	private String updatetime;// VARCHAR2(20) 更新时间
	private String happentime;// VARCHAR2(20) 建档时间
	private String createtime;// VARCHAR2(20) 创建时间
	private String createorg;// VARCHAR2(20) 创建机构
	private String updateorg;// VARCHAR2(20) 更新机构
	private String creater;// VARCHAR2(20) 创建人
	private String modified;// VARCHAR2(20) 修改人
	private String res1;// VARCHAR2(200)
	private String res2;// VARCHAR2(20)
	private String res3;// VARCHAR2(20) 备用3
	private String res4;// VARCHAR2(20) 备用4
	private String res5;// VARCHAR2(20) 备用5 --替换为户主标志
	private String res6;// VARCHAR2(20) 备用6--替换为档案类别
	private String res7;// VARCHAR2(20) 备用7
	private String res8;// VARCHAR2(20) 备用8
	private String res9;// VARCHAR2(50) 备用9
	private String res0;// VARCHAR2(20) 活动非活动
	private String ywgms;// VARCHAR2(200) 有无过敏史
	private String ywjb;// VARCHAR2(20) 有无疾病
	private String ywbls;// VARCHAR2(200) 有无暴露史
	private String shoushu;// VARCHAR2(20) 有无手术
	private String waishang;// VARCHAR2(20) 有无外伤

	private String shuxie;// VARCHAR2(20) 有无输血
	private String jzs;// VARCHAR2(20) 有无家族史
	private String ycbs;// VARCHAR2(20) 有无遗传
	private String outWind;// VARCHAR2(20) 厨房排风设施类别
	private String hastoilet;// VARCHAR2(20) 家庭厕所类别代码
	private String water;// VARCHAR2(20) 家庭饮水类别代码
	private String fuel;// VARCHAR2(20) 家庭燃料类别代码
	private String fowlType;// VARCHAR2(20) 家庭禽畜栏类别
	private String inputname;// VARCHAR2(20) 建档人
	private String dutyDoctor;// VARCHAR2(50) 责任医生
	private String delflag;// VARCHAR2(200)
	private String unitPhone;// VARCHAR2(20) 单位/学校电话号码
	private String street_old;// VARCHAR2(10)
	private String committee_old;// VARCHAR2(13)
	private String personalid_old;// VARCHAR2(17)
	private String personalid_new;// VARCHAR2(17)
	private String cunteam;// VARCHAR2(20) 村里面的队：1：一队；2：二队；3：三队
	private String signCondition;// VARCHAR2(20) 村服务签约状态
	private String age;// NUMBER 年龄
	private String wzd;// VARCHAR2(10) 完整度
	private String qdqxz;// VARCHAR2(10) 缺项值
	private String fromType;// VARCHAR2(10) 数据来源；空为公卫，‘1’为手提箱，‘2’为PAD
	private String dietime;// VARCHAR2(100) 死亡日期
	private String dieresult;// VARCHAR2(100) 死亡原因
	private String singingtime;// VARCHAR2(64) 签约时间
	private String sfresult;// VARCHAR2(100) 失访原因
	private String qjbqk;// VARCHAR2(100) 迁往地点基本情况
	private String qjjjl;// VARCHAR2(100) 档案交接记录
	// private String zhaiyao;// 摘要
	private ZhaiYao zhaiyao;
	private YiChuanBing yichuanbing;// 遗传病
	private List<JiBing> jb;
	private List<ShouShu> ss;
	private List<ShuXue> shux;
	private List<WaiShang> wais;
	private List<JiaZuShi> jiazs;
	private List<CardType> cardtype;
	private String isYcf;// 孕产妇标识
	private String isMaterials;//是否优抚
	private String isProverty;//是否贫困


	private String householderCard;//户主身份证号
	private Integer familyNum;//家庭人口数
	private String familyStructure;//家庭机构
	private String liveSituation;//居住情况
	private String photoBase64;//头像

	public String getIsMaterials() {
		return isMaterials;
	}

	public void setIsMaterials(String isMaterials) {
		this.isMaterials = isMaterials;
	}

	public String getIsProverty() {
		return isProverty;
	}

	public void setIsProverty(String isProverty) {
		this.isProverty = isProverty;
	}

	public ZhaiYao getZhaiyao() {
		return zhaiyao;
	}

	public void setZhaiyao(ZhaiYao zhaiyao) {
		this.zhaiyao = zhaiyao;
	}

	public String getCommittee() {
		return committee;
	}

	public void setCommittee(String committee) {
		this.committee = committee;
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getCounty() {
		return county;
	}

	public void setCounty(String county) {
		this.county = county;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getPersonalid() {
		return personalid;
	}

	public void setPersonalid(String personalid) {
		this.personalid = personalid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getNation() {
		return nation;
	}

	public void setNation(String nation) {
		this.nation = nation;
	}

	public String getHouseholderMark() {
		return householderMark;
	}

	public void setHouseholderMark(String householderMark) {
		this.householderMark = householderMark;
	}

	public String getDomicileType() {
		return domicileType;
	}

	public void setDomicileType(String domicileType) {
		this.domicileType = domicileType;
	}

	public String getGbname() {
		return gbname;
	}

	public void setGbname(String gbname) {
		this.gbname = gbname;
	}

	public String getGbcode() {
		return gbcode;
	}

	public void setGbcode(String gbcode) {
		this.gbcode = gbcode;
	}

	public String getZonegb() {
		return zonegb;
	}

	public void setZonegb(String zonegb) {
		this.zonegb = zonegb;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getPostcode() {
		return postcode;
	}

	public void setPostcode(String postcode) {
		this.postcode = postcode;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getBloodType() {
		return bloodType;
	}

	public void setBloodType(String bloodType) {
		this.bloodType = bloodType;
	}

	public String getRh() {
		return rh;
	}

	public void setRh(String rh) {
		this.rh = rh;
	}

	public String getUnitName() {
		return unitName;
	}

	public void setUnitName(String unitName) {
		this.unitName = unitName;
	}

	public String getEducation() {
		return education;
	}

	public void setEducation(String education) {
		this.education = education;
	}

	public String getOccupation() {
		return occupation;
	}

	public void setOccupation(String occupation) {
		this.occupation = occupation;
	}

	public String getMarriage() {
		return marriage;
	}

	public void setMarriage(String marriage) {
		this.marriage = marriage;
	}

	public String getFirstGuardian() {
		return firstGuardian;
	}

	public void setFirstGuardian(String firstGuardian) {
		this.firstGuardian = firstGuardian;
	}

	public String getFirstRelation() {
		return firstRelation;
	}

	public void setFirstRelation(String firstRelation) {
		this.firstRelation = firstRelation;
	}

	public String getGuardianPhone1() {
		return guardianPhone1;
	}

	public void setGuardianPhone1(String guardianPhone1) {
		this.guardianPhone1 = guardianPhone1;
	}

	public String getSecondGuardian() {
		return secondGuardian;
	}

	public void setSecondGuardian(String secondGuardian) {
		this.secondGuardian = secondGuardian;
	}

	public String getSecondRelation() {
		return secondRelation;
	}

	public void setSecondRelation(String secondRelation) {
		this.secondRelation = secondRelation;
	}

	public String getGuardianPhone2() {
		return guardianPhone2;
	}

	public void setGuardianPhone2(String guardianPhone2) {
		this.guardianPhone2 = guardianPhone2;
	}

	public String getIdtype() {
		return idtype;
	}

	public void setIdtype(String idtype) {
		this.idtype = idtype;
	}

	public String getCardid() {
		return cardid;
	}

	public void setCardid(String cardid) {
		this.cardid = cardid;
	}

	public String getEducationLevel() {
		return educationLevel;
	}

	public void setEducationLevel(String educationLevel) {
		this.educationLevel = educationLevel;
	}

	public String getRelation() {
		return relation;
	}

	public void setRelation(String relation) {
		this.relation = relation;
	}

	public String getHouseholderName() {
		return householderName;
	}

	public void setHouseholderName(String householderName) {
		this.householderName = householderName;
	}

	public String getArchivesNo() {
		return archivesNo;
	}

	public void setArchivesNo(String archivesNo) {
		this.archivesNo = archivesNo;
	}

	public String getIdcardFarm() {
		return idcardFarm;
	}

	public void setIdcardFarm(String idcardFarm) {
		this.idcardFarm = idcardFarm;
	}

	public String getIdcardHos() {
		return idcardHos;
	}

	public void setIdcardHos(String idcardHos) {
		this.idcardHos = idcardHos;
	}

	public String getAllergy() {
		return allergy;
	}

	public void setAllergy(String allergy) {
		this.allergy = allergy;
	}

	public String getLinkmanName() {
		return linkmanName;
	}

	public void setLinkmanName(String linkmanName) {
		this.linkmanName = linkmanName;
	}

	public String getLinkmanPhone() {
		return linkmanPhone;
	}

	public void setLinkmanPhone(String linkmanPhone) {
		this.linkmanPhone = linkmanPhone;
	}

	public String getIdcardVas() {
		return idcardVas;
	}

	public void setIdcardVas(String idcardVas) {
		this.idcardVas = idcardVas;
	}

	public String getPaymentMode() {
		return paymentMode;
	}

	public void setPaymentMode(String paymentMode) {
		this.paymentMode = paymentMode;
	}

	public String getUpdatetime() {
		return updatetime;
	}

	public void setUpdatetime(String updatetime) {
		this.updatetime = updatetime;
	}

	public String getHappentime() {
		return happentime;
	}

	public void setHappentime(String happentime) {
		this.happentime = happentime;
	}

	public String getCreatetime() {
		return createtime;
	}

	public void setCreatetime(String createtime) {
		this.createtime = createtime;
	}

	public String getCreateorg() {
		return createorg;
	}

	public void setCreateorg(String createorg) {
		this.createorg = createorg;
	}

	public String getUpdateorg() {
		return updateorg;
	}

	public void setUpdateorg(String updateorg) {
		this.updateorg = updateorg;
	}

	public String getCreater() {
		return creater;
	}

	public void setCreater(String creater) {
		this.creater = creater;
	}

	public String getModified() {
		return modified;
	}

	public void setModified(String modified) {
		this.modified = modified;
	}

	public String getRes1() {
		return res1;
	}

	public void setRes1(String res1) {
		this.res1 = res1;
	}

	public String getRes2() {
		return res2;
	}

	public void setRes2(String res2) {
		this.res2 = res2;
	}

	public String getRes3() {
		return res3;
	}

	public void setRes3(String res3) {
		this.res3 = res3;
	}

	public String getRes4() {
		return res4;
	}

	public void setRes4(String res4) {
		this.res4 = res4;
	}

	public String getRes5() {
		return res5;
	}

	public void setRes5(String res5) {
		this.res5 = res5;
	}

	public String getRes6() {
		return res6;
	}

	public void setRes6(String res6) {
		this.res6 = res6;
	}

	public String getRes7() {
		return res7;
	}

	public void setRes7(String res7) {
		this.res7 = res7;
	}

	public String getRes8() {
		return res8;
	}

	public void setRes8(String res8) {
		this.res8 = res8;
	}

	public String getRes9() {
		return res9;
	}

	public void setRes9(String res9) {
		this.res9 = res9;
	}

	public String getRes0() {
		return res0;
	}

	public void setRes0(String res0) {
		this.res0 = res0;
	}

	public String getYwgms() {
		return ywgms;
	}

	public void setYwgms(String ywgms) {
		this.ywgms = ywgms;
	}

	public String getYwjb() {
		return ywjb;
	}

	public void setYwjb(String ywjb) {
		this.ywjb = ywjb;
	}

	public String getYwbls() {
		return ywbls;
	}

	public void setYwbls(String ywbls) {
		this.ywbls = ywbls;
	}

	public String getShoushu() {
		return shoushu;
	}

	public void setShoushu(String shoushu) {
		this.shoushu = shoushu;
	}

	public String getWaishang() {
		return waishang;
	}

	public void setWaishang(String waishang) {
		this.waishang = waishang;
	}

	public String getShuxie() {
		return shuxie;
	}

	public void setShuxie(String shuxie) {
		this.shuxie = shuxie;
	}

	public String getJzs() {
		return jzs;
	}

	public void setJzs(String jzs) {
		this.jzs = jzs;
	}

	public String getYcbs() {
		return ycbs;
	}

	public void setYcbs(String ycbs) {
		this.ycbs = ycbs;
	}

	public String getOutWind() {
		return outWind;
	}

	public void setOutWind(String outWind) {
		this.outWind = outWind;
	}

	public String getHastoilet() {
		return hastoilet;
	}

	public void setHastoilet(String hastoilet) {
		this.hastoilet = hastoilet;
	}

	public String getWater() {
		return water;
	}

	public void setWater(String water) {
		this.water = water;
	}

	public String getFuel() {
		return fuel;
	}

	public void setFuel(String fuel) {
		this.fuel = fuel;
	}

	public String getFowlType() {
		return fowlType;
	}

	public void setFowlType(String fowlType) {
		this.fowlType = fowlType;
	}

	public String getInputname() {
		return inputname;
	}

	public void setInputname(String inputname) {
		this.inputname = inputname;
	}

	public String getDutyDoctor() {
		return dutyDoctor;
	}

	public void setDutyDoctor(String dutyDoctor) {
		this.dutyDoctor = dutyDoctor;
	}

	public String getDelflag() {
		return delflag;
	}

	public void setDelflag(String delflag) {
		this.delflag = delflag;
	}

	public String getUnitPhone() {
		return unitPhone;
	}

	public void setUnitPhone(String unitPhone) {
		this.unitPhone = unitPhone;
	}

	public String getStreet_old() {
		return street_old;
	}

	public void setStreet_old(String street_old) {
		this.street_old = street_old;
	}

	public String getCommittee_old() {
		return committee_old;
	}

	public void setCommittee_old(String committee_old) {
		this.committee_old = committee_old;
	}

	public String getPersonalid_old() {
		return personalid_old;
	}

	public void setPersonalid_old(String personalid_old) {
		this.personalid_old = personalid_old;
	}

	public String getPersonalid_new() {
		return personalid_new;
	}

	public void setPersonalid_new(String personalid_new) {
		this.personalid_new = personalid_new;
	}

	public String getCunteam() {
		return cunteam;
	}

	public void setCunteam(String cunteam) {
		this.cunteam = cunteam;
	}

	public String getSignCondition() {
		return signCondition;
	}

	public void setSignCondition(String signCondition) {
		this.signCondition = signCondition;
	}

	public String getAge() {
		return age;
	}

	public void setAge(String age) {
		this.age = age;
	}

	public String getWzd() {
		return wzd;
	}

	public void setWzd(String wzd) {
		this.wzd = wzd;
	}

	public String getQdqxz() {
		return qdqxz;
	}

	public void setQdqxz(String qdqxz) {
		this.qdqxz = qdqxz;
	}

	public String getFromType() {
		return fromType;
	}

	public void setFromType(String fromType) {
		this.fromType = fromType;
	}

	public String getDietime() {
		return dietime;
	}

	public void setDietime(String dietime) {
		this.dietime = dietime;
	}

	public String getDieresult() {
		return dieresult;
	}

	public void setDieresult(String dieresult) {
		this.dieresult = dieresult;
	}

	public String getSingingtime() {
		return singingtime;
	}

	public void setSingingtime(String singingtime) {
		this.singingtime = singingtime;
	}

	public String getSfresult() {
		return sfresult;
	}

	public void setSfresult(String sfresult) {
		this.sfresult = sfresult;
	}

	public String getQjbqk() {
		return qjbqk;
	}

	public void setQjbqk(String qjbqk) {
		this.qjbqk = qjbqk;
	}

	public String getQjjjl() {
		return qjjjl;
	}

	public void setQjjjl(String qjjjl) {
		this.qjjjl = qjjjl;
	}

	public YiChuanBing getYichuanbing() {
		return yichuanbing;
	}

	public void setYichuanbing(YiChuanBing yichuanbing) {
		this.yichuanbing = yichuanbing;
	}

	public List<JiBing> getJb() {
		return jb;
	}

	public void setJb(List<JiBing> jb) {
		this.jb = jb;
	}

	public List<ShouShu> getSs() {
		return ss;
	}

	public void setSs(List<ShouShu> ss) {
		this.ss = ss;
	}

	public List<ShuXue> getShux() {
		return shux;
	}

	public void setShux(List<ShuXue> shux) {
		this.shux = shux;
	}

	public List<WaiShang> getWais() {
		return wais;
	}

	public void setWais(List<WaiShang> wais) {
		this.wais = wais;
	}

	public List<JiaZuShi> getJiazs() {
		return jiazs;
	}

	public void setJiazs(List<JiaZuShi> jiazs) {
		this.jiazs = jiazs;
	}

	public List<CardType> getCardtype() {
		return cardtype;
	}

	public void setCardtype(List<CardType> cardtype) {
		this.cardtype = cardtype;
	}

	public String getIsYcf() {
		return isYcf;
	}

	public void setIsYcf(String isYcf) {
		this.isYcf = isYcf;
	}


	public String getHouseholderCard() {
		return householderCard;
	}

	public void setHouseholderCard(String householderCard) {
		this.householderCard = householderCard;
	}

	public Integer getFamilyNum() {
		return familyNum;
	}

	public void setFamilyNum(Integer familyNum) {
		this.familyNum = familyNum;
	}

	public String getFamilyStructure() {
		return familyStructure;
	}

	public void setFamilyStructure(String familyStructure) {
		this.familyStructure = familyStructure;
	}

	public String getLiveSituation() {
		return liveSituation;
	}

	public void setLiveSituation(String liveSituation) {
		this.liveSituation = liveSituation;
	}

	public static List<HdPersonalInfo> convertData(Context context) {
		List<HdPersonalInfo> datas = new ArrayList<>();
		FDbManager fdb = FDbManager.getInstance(context);
		// List<HD_PERSONAL_HEALTH_PHOTO
		List<ARCHIVE_BASEINFO> infos = fdb.findAllByWhere(ARCHIVE_BASEINFO.class,
					"IS_UPDATE is not 'N'" + " AND CREATEORG='" + NovaApplication.getJgbh() + "'");

		Log.e("CREATER",NovaApplication.getJgrno()+"基本信息"+infos.size());
		if (infos != null && !infos.isEmpty()) {
			HdPersonalInfo data = null;
			for (ARCHIVE_BASEINFO info : infos) {
				try {
					data = new HdPersonalInfo();
					// ARCHIVE_ILLNESSHISTORYINFO ai = (ARCHIVE_ILLNESSHISTORYINFO)
					// fdb
					// .findAllByWhere(ARCHIVE_ILLNESSHISTORYINFO.class, "IDCARD =
					// '" + info.getIDCARD() + "'");

					data.setCommittee(info.getCOMMITTEE()); // 居委会
					data.setStreet(info.getSTREET()); // 街道//TODO 必填
					data.setCounty(info.getCOUNTY()); // 县
					data.setCity(info.getCITY()); // 市
					data.setProvince(info.getPROVINCE()); // 省
					data.setPersonalid(info.getARCHIVEID()); // 健康档案号
					data.setName(info.getCUSTOMERNAME()); // 姓名
					data.setSex(info.getSEX()); // 性别
					data.setBirthday(info.getBIRTHDAY() == null ? "" : GlobalConts.dateFormat.format(info.getBIRTHDAY())); // 出生日期
					data.setMobile(info.getPHONE()); // 本人联系电话
					data.setNation(info.getNATION()); // 民族
					data.setHouseholderMark(info.getHOUSE_RELATION()); // 户主标志
					data.setDomicileType(info.getLIVETYPE()); // 常住地址户籍标志
					data.setGbname(info.getHOUSEHOLD_ADDR()); // 户籍地址
					// data.setGbcode(info.get()); //
					// data.setZonegb(info.get()); //
					data.setAddress(info.getADDR()); // 现住址
					// data.setPostcode(info.get()); //
					// data.setPhone(info.get()); //
					data.setBloodType(info.getBLOODTYPE()); // ABO血型代码
					data.setRh(info.getRH()); // Rh血型标志
					data.setUnitName(info.getWORKUNIT()); // 单位名称
					data.setEducation(info.getCULTURE()); // 学历代码//TODO 必填
					data.setOccupation(info.getJOB()); // 职业
					data.setMarriage(info.getMARITALSTATUS()); // 婚姻状况代码//TODO 必填
					data.setIsMaterials(info.getISMATERIALS());
					data.setIsProverty(info.getISPROVERTY());
					// data.setFirstGuardian(info.get()); //
					// data.setFirstRelation(info.get()); //
					// data.setGuardianPhone1(info.get()); //
					// data.setSecondGuardian(info.get()); //
					// data.setSecondRelation(info.get()); //
					// data.setGuardianPhone2(info.get()); //
					// data.setIdtype(info.getCARDTYPE()); // 身份证件类别代码(证件类型)
					data.setIdtype("DM01-99_1");
					if(info.getIDCARD()!=null&&!TextUtils.isEmpty(info.getIDCARD())){
						data.setCardid(info.getIDCARD().toUpperCase()); // 身份证（现做证件号码）
					}else{
						data.setCardid(""); // 身份证（现做证件号码）
					}

					// data.setEducationLevel(info.get); //
					// data.setRelation(info.get); //
					// data.setHouseholderName(info.get); //
					// data.setArchivesNo(info.get); //
					// data.setIdcardFarm(info.get); //
					// data.setIdcardHos(info.get); //
					// data.setAllergy(info.get); //
					data.setLinkmanName(info.getCONTACTNAME()); // 联系人姓名
					data.setLinkmanPhone(info.getCONTACTPHONE()); // 联系人电话
					// data.setIdcardVas(info.get()); //
					data.setPaymentMode(info.getMEDICALPAYTYPE()); // 医疗费支付方式代码
					data.setRes7(info.getMEDICALPAYTYPE_OTHER());// 支付方式其他
					data.setUpdatetime(info.getLAST_UPDATE_DATE() == null ? GlobalConts.datetimeFormat.format(new Date())
							: GlobalConts.datetimeFormat.format(info.getLAST_UPDATE_DATE())); // 更新时间
					data.setHappentime(
							info.getCREATED_DATE() == null ? GlobalConts.datetimeFormat.format(new Date()) : info.getCREATED_DATE()); // 建档时间//TODO
					// 必填
					data.setCreatetime(info.getCREATED_DATE() == null ? GlobalConts.datetimeFormat.format(new Date())
							: info.getCREATED_DATE()); // 创建时间
					data.setCreateorg(info.getCREATEORG()); // 创建机构
					if(TextUtils.isEmpty(info.getUPDATEORG())){
						data.setUpdateorg(info.getCREATEORG()); // 更新机构
					}else{
						data.setUpdateorg(info.getUPDATEORG()); // 更新机构
					}

					data.setCreater(info.getCREATER()); // 创建人
					data.setModified(info.getLAST_UPDATE_BY()); // 修改人
					// data.setRes1(info.get());
					// data.setRes2(info.get());
					// data.setRes3(info.get()); // 备用3
					// data.setRes4(info.get()); // 备用4
					// data.setRes5(info.get()); // 备用5 --替换为户主标志
					// data.setRes6(info.get()); // 备用6--替换为档案类别
					// data.setRes7(info.get()); // 备用7
					// data.setRes8(info.get()); // 备用8
					// data.setRes9(info.get()); // 备用9
					data.setRes0("DM01-18_1"); // 活动非活动
					// DM01-18_1 活动
					// DM01-18_2 死亡
					// DM01-18_3 失访
					// DM01-18_4 迁出

					data.setYwjb("DM01-11_1");
					data.setShoushu("DM01-11_1");
					data.setWaishang("DM01-11_1");
					data.setShuxie("DM01-11_1");

					data.setYcbs(info.getDISEASE()); // 有无遗传
					if(!TextUtils.isEmpty(info.getRES4())){
						String base64 = ImageTools.imageToBase64(info.getRES4());
						data.setPhotoBase64("data:image/png;base64," + base64); //头像
					}


					// 孕产妇
					if (NovaApplication.getUserInfo() != null) {
						if (!TextUtils.isEmpty(NovaApplication.getUserInfo().getPOPULATION_TYPE())) {
							String pop = NovaApplication.getUserInfo().getPOPULATION_TYPE();
							String[] pops = pop.split(",");
							if (Arrays.asList(pops).contains(PeopleType.WOMAN)) {
								// 设置孕产妇框
								data.setIsYcf("1");
							}
						}
					}
					List<ARCHIVE_ENVIRONMENT> aes = fdb.findAllByWhere(ARCHIVE_ENVIRONMENT.class,
							"IDCARD = '" + info.getIDCARD() + "'");
					if (aes != null & !aes.isEmpty()) {
						ARCHIVE_ENVIRONMENT ae = aes.get(0);
						data.setOutWind(ae.getBLOWMEASURE()); // 厨房排风设施类别
						data.setHastoilet(ae.getTOILET()); // 家庭厕所类别代码
						data.setWater(ae.getDRINKWATER()); // 家庭饮水类别代码
						data.setFuel(ae.getFUELTYPE()); // 家庭燃料类别代码
						data.setFowlType(ae.getLIVESTOCKRAIL()); // 家庭禽畜栏类别
					}
					data.setInputname(info.getCREATED_BY()); // 建档人//TODO 必填
					data.setDutyDoctor(info.getDOCTOR()); // 责任医生
					// data.setDelflag(info.get()); //
					// data.setUnitPhone(info.get); // 单位/学校电话号码
					// data.setStreet_old(info.get); //
					// data.setCommittee_old(info.get); //
					// data.setPersonalid_old(info.get); //
					// data.setPersonalid_new(info.get); //
					// data.setCunteam(info.get); // 村里面的队：1：一队；2：二队；3：三队
					data.setSignCondition(info.getDISTRICT_ID()); // 村服务签约状态
					// data.setAge(info.get); // 年龄

					data.setFromType("2"); // 数据来源；空为公卫，‘1’为手提箱，‘2’为PAD
					// data.setDietime(info.get); // 死亡日期
					// data.setDieresult(info.get); // 死亡原因
					// data.setSingingtime(info.get); // 签约时间
					// data.setSfresult(info.get); // 失访原因
					// data.setQjbqk(info.get); // 迁往地点基本情况
					// data.setQjjjl(info.get); // 档案交接记录

					data.setHouseholderName(info.getHOUSE_RELATION());
					data.setHouseholderCard(info.getHOUSE_REAL_OTHER());
					if(null!=info.getRES0()&&""!=info.getRES0()&&info.getRES0().length()>0){
						data.setFamilyNum(Integer.parseInt(info.getRES0()));
					}
					data.setFamilyStructure(info.getRES1());
					data.setLiveSituation(info.getRES2());
					ZhaiYao zhaiyao = new ZhaiYao();

					if (!TextUtils.isEmpty(info.getPILLALLERGIC())) {
						data.setYwgms("DM01-11_2"); // 有无过敏史DM02-10_1
						zhaiyao.setAllergicSource(info.getPILLALLERGIC()); // 过敏源代码组合
						// (有过敏史填写)
					} else {
						data.setYwgms("DM01-11_1"); // 过敏史为无的标识“DM01-11_1”
					}
					zhaiyao.setAllergicOther(info.getPILLALLERGIC_OTHER()); // 药物过敏史其它
					// (有过敏史填写)
					if (!TextUtils.isEmpty(info.getEXPOSURE())) {
						data.setYwbls("DM01-11_2"); // TODO 有无暴露史
						zhaiyao.setRes9(info.getEXPOSURE()); // 个人基本信息暴露史内容 (有暴露史填写)
					} else {
						data.setYwbls("DM01-11_1");// 暴露史为无的标识“DM01-11_1”
					}
					zhaiyao.setDisability(info.getDISEASENDITION()); // 纳入残疾管理代码组合
					// (有残疾情况填写)
					zhaiyao.setDisabilityOther(info.getDISEASENDITION_EX()); // 残疾其他
					// (有残疾情况填写)
					data.setZhaiyao(zhaiyao); // 摘要
					if (!TextUtils.isEmpty(info.getDISEASE_EX())) {
						YiChuanBing yichuan = new YiChuanBing();
						yichuan.setHeredityhistory(info.getDISEASE_EX());
						data.setYichuanbing(yichuan);
					}

					List<ARCHIVE_ILLNESSHISTORYINFO> aills = fdb.findAllByWhere(ARCHIVE_ILLNESSHISTORYINFO.class,
							"IDCARD = '" + info.getIDCARD() + "'");

					List<JiBing> jbs = new ArrayList<JiBing>();
					List<ShouShu> sss = new ArrayList<>();
					List<ShuXue> shuxs = new ArrayList<>();
					List<WaiShang> waishangs = new ArrayList<>();
					List<JiaZuShi> jiazushis = new ArrayList<>();
					JiBing jibing = null;
					ShouShu shoushu = null;
					ShuXue shuxue = null;
					WaiShang waishang = null;
					JiaZuShi jiazushi = null;
					if (aills != null & !aills.isEmpty()) {
						for (ARCHIVE_ILLNESSHISTORYINFO aill : aills) {
							switch (aill.getILLNESSTYPE()) {
								case "1":
									data.setYwjb("DM01-11_2");
									jibing = new JiBing();
									jibing.setAskDate(aill.getDIAGNOSETIME() == null ? ""
											: GlobalConts.dateFormat.format(aill.getDIAGNOSETIME()));// 确诊时间
									jibing.setFormerlyType(aill.getILLNESSNAME());// 疾病名称
									jibing.setCancer(aill.getTHERIOMA());// 恶性肿瘤
									jibing.setIndustrialDisease(aill.getJOBILLNESS());// 职业病
									jibing.setDiseaseOther(aill.getILLNESS_OTHER());
									jbs.add(jibing);
									break;
								case "2":
									if (!TextUtils.isEmpty(aill.getILLNESSNAME_OTHER())) {
										data.setShoushu("DM01-11_2"); // TODO 有无手术
										shoushu = new ShouShu();
										shoushu.setOpsName(aill.getILLNESSNAME_OTHER());// 手术名称
										shoushu.setOpsDate(aill.getDIAGNOSETIME() == null ? ""
												: GlobalConts.dateFormat.format(aill.getDIAGNOSETIME()));// 手术日期
										sss.add(shoushu);
									}
									break;
								case "3":
									if (!TextUtils.isEmpty(aill.getILLNESSNAME_OTHER())) {
										data.setWaishang("DM01-11_2"); // TODO 有无外伤
										waishang = new WaiShang();
										waishang.setCutPart(aill.getILLNESSNAME_OTHER());// 外伤名称
										waishang.setCutDate(aill.getDIAGNOSETIME() == null ? ""
												: GlobalConts.dateFormat.format(aill.getDIAGNOSETIME()));// 外伤时间
										waishangs.add(waishang);
									}
									break;
								case "4":
									if (!TextUtils.isEmpty(aill.getILLNESSNAME_OTHER())) {
										data.setShuxie("DM01-11_2"); // TOD
										shuxue = new ShuXue();
										shuxue.setBloodReason(aill.getILLNESSNAME_OTHER());// 输血原因
										shuxue.setBloodDate(aill.getDIAGNOSETIME() == null ? ""
												: GlobalConts.dateFormat.format(aill.getDIAGNOSETIME()));// 输血日期
										shuxs.add(shuxue);
									}
									break;
							}
						}
						data.setJb(jbs);
						data.setSs(sss);
						data.setShux(shuxs);
						data.setWais(waishangs);

					} else {
						data.setJb(new ArrayList());
						data.setSs(new ArrayList());
						data.setShux(new ArrayList());
						data.setWais(new ArrayList());
					}

					List<ARCHIVE_FAMILYHISTORYINFO> historys = fdb.findAllByWhere(ARCHIVE_FAMILYHISTORYINFO.class,
							"IDCARD = '" + info.getIDCARD() + "'");
					if (historys != null && !historys.isEmpty()) {
						data.setJzs("DM01-11_2"); //
						ARCHIVE_FAMILYHISTORYINFO af = historys.get(0);
						jiazushi = new JiaZuShi();
						// case "1":// 父亲
						if (!TextUtils.isEmpty(af.getFATHERHISTORY())) {
							data.setJzs("DM01-11_2"); //
							jiazushi = new JiaZuShi();
							jiazushi.setRelation("DM01-06_5_51");// 关系
							jiazushi.setMedicalhistory(af.getFATHERHISTORY());// 疾病名称
							jiazushi.setReg0(af.getFATHERHISTORY_OTHER());
							jiazushis.add(jiazushi);
						}
						// DM01-06_5_51,
						// DM01-06_5_52，
						// DM01-06_2,
						// DM01-06_7
						// case "2":// 母亲
						if (!TextUtils.isEmpty(af.getMOTHERHISTORY())) {
							data.setJzs("DM01-11_2"); //
							jiazushi = new JiaZuShi();
							jiazushi.setRelation("DM01-06_5_52");// 关系
							jiazushi.setMedicalhistory(af.getMOTHERHISTORY());// 疾病名称
							jiazushi.setReg0(af.getMOTHERHISTORY_OTHER());
							jiazushis.add(jiazushi);
						}
						// case "3":// 兄弟姐妹
						if (!TextUtils.isEmpty(af.getBROTHERSISTERHISTORY())) {
							data.setJzs("DM01-11_2"); //
							jiazushi = new JiaZuShi();
							jiazushi.setRelation("DM01-06_7");// 关系
							jiazushi.setMedicalhistory(af.getBROTHERSISTERHISTORY());// 疾病名称
							jiazushi.setReg0(af.getBROTHERSISTERHISTORY_OTHER());
							jiazushis.add(jiazushi);
						}
						// case "4":// 子女
						if (!TextUtils.isEmpty(af.getCHILDRENHISTORY())) {
							data.setJzs("DM01-11_2"); //
							jiazushi = new JiaZuShi();
							jiazushi.setRelation("DM01-06_2");// 关系
							jiazushi.setMedicalhistory(af.getCHILDRENHISTORY());// 疾病名称
							jiazushi.setReg0(af.getCHILDRENHISTORY_OTHER());
							jiazushis.add(jiazushi);
						}

						data.setJiazs(jiazushis);
					} else {
						data.setJzs("DM01-11_1");
					}
					String arr[] = GlobalConts.assessIntegrity(data.getSex(), data.getBirthday(), data.getMobile(),
							data.getNation(), data.getDomicileType(), data.getBloodType(), data.getRh(), data.getUnitName(),
							data.getEducation(), data.getOccupation(), data.getMarriage(), data.getCardid(),
							data.getLinkmanName(), data.getLinkmanPhone(), data.getPaymentMode(), data.getYwgms(),
							data.getYwbls(), data.getYcbs(), data.getZhaiyao().getDisability());
					data.setWzd(arr[0]); // 完整度
					data.setQdqxz(arr[1]); // 缺项值
					datas.add(data);
				}catch (Exception e){
					e.printStackTrace();
					continue;
				}

			}
		}
		return datas;
	}

	public String getPhotoBase64() {
		return photoBase64;
	}

	public void setPhotoBase64(String photoBase64) {
		this.photoBase64 = photoBase64;
	}
}